<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<a  href="https://wwww.taobao.com" target="_blank"> 淘宝</a>
		<a class="jd" href="https://wwww.jd.com" target="_blank"> 京东</a>
		<a name="pdd" href="https://wwww.pinduoduo.com" target="_blank"> 拼多多</a>
		<a id="bd" href="https://wwww.baidu.com" target="_blank"> 百度</a>
	
<script >
	/*
	window.alert('欢迎来到天上人间');
	window.alert(document.getElementsByTagName("a")[0]);
	alert(document.getElementsByTagName("a")[0].innerText);
	*/
   //tagname 标签访问
   //console.log(document.getElementsByTagName("a")[0].innerText);
   //console.log(document.getElementsByTagName("a")[0].href);
   //classname	
   console.log(document.getElementsByClassName("jd")[0].innerText);
   console.log(document.getElementsByClassName("jd")[0].href);
   //name	
   console.log(document.getElementsByName("pdd")[0].innerText);
   console.log(document.getElementsByName("pdd")[0].href);
   //id		//返回是一个值，无需数组方式
   console.log(document.getElementById("bd").innerText);
   console.log(document.getElementById("bd").href);
   
   
   var a = document.getElementsByTagName("a")[0];
   a.innerText="百度";
   a.href = "https://wwww.baidu.com";

   
   		
   		var obj=[];
   		var obj={};
   		var obj=null
   
</script>

	</body>
</html>

